<div id="myapply">
    <div class="m-subheader">
        <div class="row align-items-center">
            <div class="mr-auto col-auto">
                <h3 class="m-subheader__title m-subheader__title--separator">
                    <span>我的申请</span>
                </h3>
                <span class="m-section__sub">
                    我发起的申请单
                </span>
            </div>

        </div>
    </div>

    <div class="m-content">
        <div class="m-portlet m-portlet--mobile" style="margin: 0;">
            <div class="m-portlet__body" style="height: 724px;">
                <div class="row align-items-center">
                    <!--<Primeng-TurboTable-Start>-->
                    <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                        <p-table #dataTable (onLazyLoad)="getMyApplyWorkflow($event)" [value]="getWorkflowInstanceViewDtos"
                            rows="{{primengTableHelper.defaultRecordsCountPerPage}}" [paginator]="false" [lazy]="true"
                            [scrollable]="true" ScrollWidth="100%" [responsive]="primengTableHelper.isResponsive"
                            [resizableColumns]="true">
                            <ng-template pTemplate="header">
                                <tr>
                                    <th style="width: 100px">
                                        操作
                                    </th>
                                    <th style="width: 30px">
                                        序号
                                    </th>
                                    <th style="width: 100px">
                                        申请单号
                                    </th>
                                    <th style="width: 150px">
                                        流程名
                                    </th>
                                    <th style="width: 150px">
                                        发起日期
                                    </th>
                                    <th style="width: 150px">
                                        步骤名
                                    </th>
                                    <th style="width: 150px">
                                        申请状态
                                    </th>
                                </tr>
                            </ng-template>
                            <ng-template pTemplate="body" let-record="$implicit" let-ri="rowIndex">
                                <tr>
                                    <td style="width: 100px">
                                        <button *ngIf="record.status==0" (click)="Cancel(record.id)" class="btn btn-sm btn-primary mb-3">
                                            撤销
                                        </button>
                                        <button (click)="Detail(record)" class="btn  btn-sm btn-primary mb-3"> 详情
                                        </button>
                                    </td>
                                    <td style="width: 30px">
                                        <span class="ui-column-title"> </span>    {{ri+1}}
                                    </td>
                                    <td style="width: 100px">
                                        <div [ngSwitch]="record.applyCode">
                                            <div *ngSwitchCase="">
                                                <div class="m-loader m-loader--warning" style="width: 30px; display: inline-block;"></div>
                                            </div>
                                            <div *ngSwitchDefault>
                                                <span class="m-badge m-badge--info m-badge--dot"></span>&nbsp;
                                                <span class="m--font-bold"> {{record.applyCode}}</span>
                                            </div>
                                        </div>
                                    </td>
                                    <td style="width: 150px">
                                        <div [ngSwitch]="record.workflowDefinitionId">
                                            <div *ngSwitchCase="">
                                                <div class="m-loader m-loader--warning" style="width: 30px; display: inline-block;"></div>
                                            </div>
                                            <div *ngSwitchDefault>
                                                <h6>
                                                    <font style="vertical-align: inherit;">
                                                        <span class="m--font-metal"> {{record.workflowDefinitionId}}</span>
                                                    </font>
                                                </h6>
                                                <h6>
                                                    <font style="vertical-align: inherit;">
                                                        <span class="m-badge m-badge--info m-badge--dot"></span>
                                                        <span class="m--font-bold"> {{record.code}}</span>
                                                    </font><br>
                                                </h6>

                                            </div>
                                        </div>
                                    </td>
                                    <td style="width: 150px">
                                        {{record.createTime | date:'short' }}
                                    </td>
                                    <td style="width: 150px">
                                        <div [ngSwitch]="record.currentStepName">
                                            <div *ngSwitchCase="">
                                                <div class="m-loader m-loader--warning" style="width: 30px; display: inline-block;"></div>
                                            </div>
                                            <div *ngSwitchDefault>
                                                <span class="m-badge m-badge--info m-badge--dot"></span>&nbsp;
                                                <span class="m--font-bold"> {{record.currentStepName}}</span>
                                            </div>
                                        </div>
                                    </td>
                                    <td style="width: 150px">
                                        <div [ngSwitch]="record.status">
                                            <div *ngSwitchCase="">
                                                <div class="m-loader m-loader--warning" style="width: 30px; display: inline-block;"></div>
                                            </div>
                                            <div *ngSwitchDefault>
                                                <span *ngIf="record.status==0" class="label m-badge m-badge--primary m-badge--wide"
                                                    data-toggle="tooltip" title="运行" data-placement="top">
                                                    运行
                                                </span>
                                                <span *ngIf="record.status==1" class="label m-badge m-badge--warning m-badge--wide"
                                                    data-toggle="tooltip" title="已暂停" data-placement="top">
                                                    已暂停
                                                </span>
                                                <span *ngIf="record.status==2" class="label m-badge m-badge--success m-badge--wide"
                                                    data-toggle="tooltip" title="完成" data-placement="top">
                                                    完成
                                                </span>
                                                <span *ngIf="record.status==3" class="label m-badge m-badge--danger m-badge--wide"
                                                    data-toggle="tooltip" title="已终止" data-placement="top">
                                                    已终止
                                                </span>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </ng-template>
                        </p-table>
                        <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                            {{'NoData' | localize}}
                        </div>
                        <div class="primeng-paging-container">
                            <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage" #paginator
                                (onPageChange)="getMyApplyWorkflow($event)" [totalRecords]="primengTableHelper.totalRecordsCount"
                                [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">

                            </p-paginator>
                            <span class="total-records-count">
                                {{'TotalRecordsCount' | localize:primengTableHelper.totalRecordsCount}}
                            </span>
                        </div>
                    </div>
                    <!--<Primeng-TurboTable-End>-->
                </div>
            </div>
        </div>
    </div>
</div>

<flowworkauditdetailmodel #flowworkauditDetailModel></flowworkauditdetailmodel>

<flowworkauditmodel #flowworkauditform></flowworkauditmodel>
<!-- <ng-template #alertContainer></ng-template> -->
